﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Interop.Word;

namespace WFL.Office.Word
{
    public class WordDocuments
    {
        private Documents _documents;

        public WordApplication Application
        {
            get;
            internal set;
        }

        internal WordDocuments(Documents documents)
        {
            _documents = documents;
        }

        public WordDocument Add(string template = null, bool newTemplate = false, NewDocumentType documentType = NewDocumentType.wdNewBlankDocument, bool visible = false)
        {
            object templateArg = template ?? Type.Missing;
            Document document = _documents.Add(ref templateArg, newTemplate, documentType, visible);
            return new WordDocument(document) { Application = Application };
        }

        public WordDocument Open(string fileName)
        {
            object objFileName = fileName;
            return new WordDocument(_documents.Open(ref objFileName)) { Application = Application };
        }
    }
}
